{include file='public/header'}
{include file='public/list'}   
 <!--state overview end-->            <div class="row">
                <div class="col-md-12">
                    <!--work progress start-->
                    <section class="panel">
                        <header class="panel-heading">
                        修改密码
                        </header>
                        <div class="panel-body">
		   
           <form class="form-horizontal tasi-form" action="" method="post" id="form">
                              <div class="form-group">
                                        <label class="col-sm-2 col-sm-2 control-label">账号</label>
                                        <div class="col-sm-10">
                                            <input class="form-control" name="username" type="text" value="admin" readonly="true">
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="col-sm-2 col-sm-2 control-label">旧密码</label>
                                        <div class="col-sm-10">
                                            <input class="form-control" name="opassword" type="password" >
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="col-sm-2 col-sm-2 control-label">新密码</label>
                                        <div class="col-sm-10">
                                            <input class="form-control" name="password" type="password" >
                                        </div>
                                    </div>


                                    <div class="form-group">
                                        <label class="col-sm-2 col-sm-2 control-label">确认密码</label>
                                        <div class="col-sm-10">
                                            <input class="form-control" name="rpassword" type="password"  >
                                        </div>
                                    </div>



			<div id="bottom" class="form-group">
			<label class="col-sm-2 col-sm-2 control-label"></label>
			  <a class="btn btn-info btn-lg" value="true" id="submit" onclick='pro_edit()'/><i class="fa fa-refresh" id="spinner"></i> <span id="btnText">更新密码</span></a>
            </div>
                            </form>
                        </div>
                    </section>
                    <!--work progress end-->
                </div>

        </section>
    </section>
    <!--main content end-->
{include file='public/footer'}
<script type="text/javascript">
function pro_edit(){
    var opassword = $("input[name='opassword']").val();
    var password = $("input[name='password']").val();
    var rpassword = $("input[name='rpassword']").val();
    if(opassword==''){
        layer.msg('请输入旧密码!',{icon: 2,time:1000});
        return false;
    }
    if(password==''){
        layer.msg('请输入新密码!',{icon: 2,time:1000});
        return false;
    }
    if(rpassword==''){
        layer.msg('请再次输入新密码!',{icon: 2,time:1000});
        return false;
    }
    if(rpassword!= password){
        layer.msg('两次密码不一致!',{icon: 2,time:1000});
        return false;
    }
    $.ajax({
        type: 'post',
        url: '{:url("admin/config/profile")}',
        data: $('#form').serialize(),
        success: function(data){
            if(data.code==1){
                layer.msg(data.msg, 
                {icon:1,time:1000},function(){
                     window.location.href = data.url;});
            }else{
                layer.msg(data.msg, 
                {icon:2,time:1000});   
            }
        }
    });
}
</script> 